﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XFramework;

/// <summary>
/// 新闻系统
/// </summary>
public class NewsSystem : IGameModule
{
    public Dictionary<int, News> newsDic;
    
    public NewsSystem()
    {
        newsDic = new Dictionary<int, News>();

        // Test
        News news = new News()
        {
            id = 10001,
            title = "苏黎世火山喷发",
            description = "火山喷发了",
            mainImage = "UI/Phone/NewsApp/Fire",
            content = "火上喷发啦，好吓人啊好吓人"
        };
        newsDic.Add(news.id, news);
    }

    /// <summary>
    /// 
    /// </summary>
    public IEnumerable<News> GetAllNews()
    {
        return newsDic.Values;
    }

    #region 接口实现

    public int Priority => 10000;

    public void Shutdown()
    {
    }

    public void Update(float elapseSeconds, float realElapseSeconds)
    {
    }

    #endregion
}

/// <summary>
/// 新闻信息
/// </summary>
public class News
{
    /// <summary>
    /// 编号
    /// </summary>
    public int id;
    /// <summary>
    /// 标题
    /// </summary>
    public string title;
    /// <summary>
    /// 描述
    /// </summary>
    public string description;
    /// <summary>
    /// 主图路径
    /// </summary>
    public string mainImage;
    /// <summary>
    /// 新闻类容
    /// </summary>
    public string content;
    /// <summary>
    /// 插图路径
    /// </summary>
    public string[] illustrations;
}